Attributes
The Character Meta for the Attributes Module.
Functions
characterMeta:addBoost(boostID, attribID, boostAmount)
Adds a boost to the character's attributes.
Parameters
-
boostID
String
The ID of the boost to add.
-
attribID
String
The ID of the attribute to which the boost should be added.
-
boostAmount
Integer
The amount of boost to add to the attribute.
Example Usage
character:removeBoost("some_boost_id", "some_attribute_id", 10)
characterMeta:getAttrib(key, default)
Retrieves the value of a character attribute, including applied boosts.
Parameters
-
key
String
The key of the attribute to retrieve.
-
default
Integer
default: 0
The default value to return if the attribute is not found.
Returns
-
any
number The value of the specified attribute, including applied boosts.
Example Usage
local attributeValue = character:getAttrib("some_attribute_key")
characterMeta:getBoost(attribID)
Retrieves the boost value for a specific attribute.
Parameters
-
attribID
Integer
The ID of the attribute for which to retrieve the boost.
Returns
-
any
number|nil The boost value for the specified attribute, or nil if no boost is found.
Example Usage
local boostValue = character:getBoost("some_attribute_id")
characterMeta:getBoosts()
Retrieves all boosts applied to the character's attributes.
Returns
-
any
table A table containing all boosts applied to the character's attributes.
Example Usage
local boostsTable = character:getBoosts()
characterMeta:getMaxStamina()
Retrieves the maximum stamina for a character. This function determines the maximum stamina a character can have, either from a hook or a default value.
Returns
-
integer
The maximum stamina value.
characterMeta:getStamina()
Retrieves the current stamina for a character. This function returns the character's current stamina, using either a local variable or a default value.
Returns
-
integer
The current stamina value.
characterMeta:removeBoost(boostID, attribID)
Removes a boost from the character's attributes.
Parameters
-
boostID
String
The ID of the boost to remove.
-
attribID
String
The ID of the attribute from which the boost should be removed.
Example Usage
character:removeBoost("some_boost_id", "some_attribute_id")
characterMeta:setAttrib(key, value)
Sets the value of a character attribute.
Parameters
-
key
String
The key of the attribute to set.
-
value
Integer
The value to set for the attribute.
Example Usage
character:setAttrib("some_attribute_key", 10)
characterMeta:updateAttrib(key, value)
Updates the value of a character attribute by adding a specified value to it.
Parameters
-
key
String
The key of the attribute to update.
-
value
Integer
The value to add to the attribute.
Example Usage
character:updateAttrib("some_attribute_key", 10)